<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head profile="http://gmpg.org/xfn/11">
	<?php
		echo $this->Html->charset('utf-8');
		echo '<title>' . $title_for_layout . '</title>';
		echo $this->Html->css('news');
		echo $scripts_for_layout;
	?>
</head>

<body>

<div id="container">
	<?php if ($this->Session->check('Message.flash')) echo $this->Session->flash(); ?>
	<?php if ($this->Session->check('Message.auth')) echo $this->Session->flash('auth'); ?>
	
	<div id="header">
<?php
	if (empty($this->params['admin'])) {
?>
	<div id="sidebar">
	    <?php
			if (isset($blog)) {
	    ?>
		<h1><?php __('Search'); ?></h1>
		<div>
			<?php
				echo $this->Form->create('Post', array('url'=>'/lil_blogs/posts/index/' . $blog['Blog']['short_name']));
				echo '<fieldset>';
				echo $this->Form->input('criterio', array('div'=>false, 'label'=>false, 'size'=>15));
				echo $this->Form->submit('Go', array('div'=>false));
				echo '</fieldset>';
				echo $form->end();
			?>
		</div>
		<?php
			}
	    ?>
		<?php
			if (isset($Auth)) {
		?>
		<h1><?php printf(__('Howdy, %s', true), $Auth['User'][Configure::read('Lil.userDisplayField')]); ?></h1>
		<ul>
			<li><?php echo $this->Html->link(__('Dashboard', true), '/admin'); ?></li>
			<li><?php echo $this->Html->link(__('Logout', true), '/logout'); ?></li>
		</ul>
		<?php
			} else {
		?>
		<h1><?php __('Admin'); ?></h1>
		<ul>
			<li><?php echo $this->Html->link(__('Login', true), '/login'); ?></li>
		</ul>
		<?php
			}
		?>
	</div> <!-- #sidebar -->
<?php
	}
?>
		<div id="head">
		<h1><?php
			if (isset($blog)) {
				echo $this->Html->link($blog['Blog']['name'], array(
					'controller' => 'posts',
					'action'     => 'index',
					'blog'       => $blog['Blog']['short_name'],
					'admin'      => false,
				));
			} else {
				__('LilBlogs List', true);
			}
		?></h1>
		<?php echo $this->Html->clean($blog['Blog']['description']); ?>
		<div style="clear: both;"></div>
		</div> <!-- #head -->
		
	</div> <!-- #header -->

	<div id="content">
		<?php echo $content_for_layout ?>
	</div> <!-- #content -->
	
	<div id="footer" style="clear:both">
		<?php
			if (!empty($blog)) {
				echo $html->link(__('RSS Blogs\'s Posts', true), array('plugin'=>'lil_blogs', 'controller'=>'posts', 'action'=>'index', 'blog'=>$blog['Blog']['short_name'].'.rss'));
				echo ' * ';
				echo $html->link(__('RSS All Blogs\'s Comments', true), array('plugin'=>'lil_blogs', 'controller'=>'comments', 'action'=>'index', 'blog'=>$blog['Blog']['short_name'].'.rss'));
				if (isset($post)) {
					echo ' * ';
					echo $html->link(__('RSS This Post\'s Comments', true), array('plugin'=>'lil_blogs', 'controller'=>'comments', 'action'=>'index', 'blog'=>$blog['Blog']['short_name'], 'post'=>$post['Post']['slug'] . '.rss'));
				}
			}
		?>
	</div> <!-- #footer -->

</div> <!-- #container -->
</body>
</html>